package com.micro.ai.auth.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

/**
 * 管理员创建用户请求DTO
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@Schema(description = "管理员创建用户请求")
public class UserCreateRequest {

    @Schema(description = "租户ID（必填）", example = "tn_system", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "租户ID不能为空")
    private String tenantId;

    @Schema(description = "用户名（必填，3-20个字符，只能包含字母、数字和下划线）", example = "john_doe", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "用户名不能为空")
    @Size(min = 3, max = 20, message = "用户名长度必须在3-20个字符之间")
    @Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "用户名只能包含字母、数字和下划线")
    private String username;

    @Schema(description = "邮箱（必填）", example = "john@example.com", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;

    @Schema(description = "密码（必填，8-32个字符）", example = "Password123!", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "密码不能为空")
    @Size(min = 8, max = 32, message = "密码长度必须在8-32个字符之间")
    private String password;

    @Schema(description = "确认密码（必填，需与密码一致）", example = "Password123!", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "确认密码不能为空")
    private String confirmPassword;

    @Schema(description = "显示名称（可选，最多50个字符）", example = "John Doe")
    @Size(max = 255, message = "显示名称长度不能超过255个字符")
    private String displayName;

    @Schema(description = "手机号（可选，11位中国大陆手机号）", example = "13800138000")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;

    @Schema(description = "头像URL（可选）", example = "https://example.com/avatar.jpg")
    private String avatarUrl;

    @Schema(description = "性别（可选）", example = "male", allowableValues = {"male", "female", "other", "unknown"})
    @Pattern(regexp = "^(male|female|other|unknown)$", message = "性别值必须是 male、female、other 或 unknown")
    private String gender;

    @Schema(description = "用户状态（可选，默认为 active）", example = "active", allowableValues = {"active", "inactive", "suspended", "pending"})
    @Pattern(regexp = "^(active|inactive|suspended|pending)$", message = "状态值必须是 active、inactive、suspended 或 pending")
    private String status;

    @Schema(description = "语言区域（可选，默认 zh-CN）", example = "zh-CN")
    @Size(max = 10, message = "语言区域长度不能超过10个字符")
    private String locale;

    @Schema(description = "时区（可选，默认 Asia/Shanghai）", example = "Asia/Shanghai")
    @Size(max = 50, message = "时区长度不能超过50个字符")
    private String timezone;
}

